<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <script type="text/javascript" src="/x/js/jquery.min.js"></script>
</head>
<body>
<a href="/user/index">后台管理</a>
<hr><hr>
文件上传:<br><br>
<input type="file" id="file"><button id="up">上传</button>
<script>
    $('#up').click(function () {
        var formData = new FormData;
        var f = $('#file')[0].files[0];
        formData.append('files', f)
        $.ajax({
            data: formData,
            type: 'post',
            dataType: 'json',
            processData: false,//不做处理
            contentType: false,//不做处理
            url: '/public/up',
            error: function (data) {
                alert(data)
            },
            success: function (data) {
                alert(data)
            }
        })
    })
</script>
</body>
</html>
